next
Round
Technologies
Experiences
Contribute
Login
next
Round
Technologies
Experiences
Contribute
Login
Question Loading...
Basics
Syntax and Structure
Reactivity
Event Handling
Component Basics
Lifecycle Hooks
Slots and Component Communication
Stores and State Sharing
Styling and Transitions
Conditional UI Patterns
SvelteKit Basics
SSR and SPA
Bindings
Forms and Events
Code Organization
Performance and Optimization
Security
Testing and Tooling
Advanced Features
All Topics
What are the three main sections in a .svelte file?
The Three Sections
<script> – holds JavaScript logic (variables, functions, imports, event handlers, reactive statements).
<style> – defines CSS styles, automatically scoped to the component.
Markup (HTML) – defines the UI structure and uses reactive bindings.
Example of a .svelte File